#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <string>
using namespace std;

void *threadRoutine(void *args)
{
    while (true)
    {
        cout << "新线程：" << (char *)args << "running" << endl;
        sleep(1);
        int a = 100;
        a /= 0;
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, threadRoutine, (void *)"thread 1");
    while (true)
    {
        cout << "主线程running" << endl;
        sleep(1);
    }
    return 0;
}
